package com.ibm.productivity.tools.blogplugin;

import com.ibm.productivity.tools.blogplugin.views.BlogView;
import com.ibm.productivity.tools.ui.views.RichDocumentView;
import com.ibm.productivity.tools.ui.views.RichDocumentViewEvent;
import com.ibm.productivity.tools.ui.views.RichDocumentViewListener;

public class ViewCloseListener implements RichDocumentViewListener {

	public void handleEvent(RichDocumentViewEvent event) {

		if (event.getType() == RichDocumentViewEvent.Type_Pre_Document_Close) {
			Object obj = event.getSource();
			if (obj instanceof RichDocumentView) {
				RichDocumentView viewer = (RichDocumentView) obj;

				BlogView blogView = Configure.blogView;	
				if (blogView != null) {
					blogView.getBlogDoc().getViewList().remove(viewer);
				}
			}
		}
	}

}
